import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 0
 * Date: 2023-03-13
 * Time: 12:10
 */
public class Test {

    public static void main(String[] args) {
        int[] array = {1,2,34,3,4,5,7,23,12};
        System.out.println(isOddthreenum(array));
    }

    public static boolean isOddthreenum(int[] array) {
        int i = 0;
        int count = 0;
        while(i < array.length) {
            if(array[i] %2 != 0) {
                count++;
            }else {
                count = 0;
            }
            if(count == 3) {
                int[] array2 = new int[]{array[i-2],array[i-1],array[i]};
                System.out.println(Arrays.toString(array2));
                return true;
            }
            i++;
        }
        return false;
    }

    public static void main6(String[] args) {
        int[] array = {2,2,1,1,1,2,2};
        System.out.println(findElements(array));
    }

    public static int findMostelement(int[] array) {
        int count = 0;
        for (int i = 0; i < array.length; i++) {
            for (int j = 1; j < array.length-i; j++) {
                if(array[i] == array[i+j]) {
                    count++;
                }
            }
            if(count > array.length/2) {
                return array[i];
            }
        }
        return -1;
    }

    public static void main5(String[] args) {
        int[] array = {2,1,1};
        System.out.println(findElements(array));
    }

    public static int findElements(int[] array) {
        for (int i = 0; i < array.length; i++) {
            for (int j = 1; j < array.length-i; j++) {
                if(array[i] != array[i+j]) {
                    return array[i];
                }
            }
        }
        return -1;
    }

    public static void main4(String[] args) {
        int[] nums = {2,7,11,15};
        int[] array = findTarget(nums,13);
        System.out.println(Arrays.toString(array));
    }

    public static int[] findTarget(int[] array,int target) {
        for (int i = 0; i < array.length; i++) {
            for (int j = 1; j < array.length-i; j++) {
                if(target == (array[i] + array[i+j])) {
                    return new int[]{i,j};
                }
            }
        }
        return null;
    }

    public static void main3(String[] args) {
        int[] array = {43,75,1,6,3,2,8,9,0};
        bubbleSort(array);
        System.out.println(Arrays.toString(array));
    }

    public static void bubbleSort(int[] array) {
        for(int i = 0; i < array.length-1; i++) {
            boolean flag = false;
            for (int j = 0; j < array.length-1-i; j++) {
                if(array[j] > array[j+1]) {
                    int tmp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = tmp;
                    flag = true;
                }
            }
            if(flag==false) {
                break;
            }
        }
    }


    public static void main2(String[] args) {
        int[] array = {1,2,3,4,5,6,7,8,9,10};
        System.out.println(binarySearch(array,7));
    }

    public static int binarySearch(int[] array,int key) {
        int left = 0;
        int right = array.length-1;
        while(left <= right) {
            int mid = (left+right)/2;
            if(array[mid] < key) {
                left = mid+1;
            }else if(array[mid] > key) {
                right = mid-1;
            }else {
                return mid;
            }
        }
        return -1;
    }


    public static void main1(String[] args) {
        int[] array = {1,2,3,4,5,6};
        int left = 0;
        int right = array.length-1;
        System.out.println(Arrays.toString(array));
        while(left < right) {
            while(left<right && array[left] % 2 != 0) {
                left++;
            }
            while(left<right && array[right] % 2 == 0) {
                right--;
            }
            int tmp = array[left];
            array[left] = array[right];
            array[right] = tmp;
        }
        System.out.println(Arrays.toString(array));
    }
}
